package pl.qsoft.db.annotation;

import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

import pl.qsoft.db.storedProc.intercept.BasicInvocationInterceptor;
import pl.qsoft.db.storedProc.intercept.InvocationInterceptor;
import pl.qsoft.db.storedProc.statement.ResultTransformer;

/**
 * An annotation interface for describing a database stored procedure and its parameters
 * 
 * @author Wojciech Kudla
 */

@Retention(RetentionPolicy.RUNTIME)
@Target({ElementType.TYPE})
public @interface StoredProcedureDefinition {
	
	/**
	 * Enum for defining database vendor
	 */
	public enum Vendor {ORACLE, POSTGRESQL, MYSQL}
	
	/**
	 * Full stored procedure name containing package names
	 */
	String procedureName();
	
	/**
	 * A JNDI name for a DataSource to be used in stored procedure invocation 
	 */
	String dataSource();
	
	/**
	 * A ResultTransformer implementation for transforming statement results into java objects
	 * @see ResultTransformer 
	 */
	Class<? extends ResultTransformer> resultTransformer();
	
	/**
	 * InvocationInterceptor implementation class for invoking custom logic before and after the procedure invocation
	 * @see InvocationInterceptor 
	 */
	Class<? extends InvocationInterceptor> invocationInterceptor() default BasicInvocationInterceptor.class;
	
	/**
	 * Database vendor type. This value influences the choice of the implementation of StatementHandler
	 * @see Vendor
	 * @see StatementHandler
	 */
	Vendor dataBaseVendor() default Vendor.ORACLE;
	
}
